﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>从表导入</title>
    <link href="../../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../../CCFlowEnum.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            InitBar(3); //excel 文件模式.
            var html = "";
            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "DtlImp_" + GetQueryString("FK_MapDtl") + "_BillModel";
            var i = mapExt.RetrieveFromDBSources(); //从数据库来查询.

            if (mapExt.GetPara("SelectType") == "")
                mapExt.SetPara("SelectType", "1");

            //批量为复制.
            GenerFullAllCtrlsVal(mapExt);

            //设置按钮是否可以用?
            if (i == 0)
                $("#Btn_Delete").attr("disabled", true);
            else
                $("#Btn_Delete").removeAttr("disabled");
        });

        function Save() {

            //更新.
            var fk_mapDtl = GetQueryString("FK_MapDtl");
            var en = new Entity("BP.Sys.MapDtl", fk_mapDtl);
            en.ImpModel = 3;
            en.Update();
            window.location.href = window.location.href;
        }
        function Delete() {
            if (confirm('您确定要删除吗？') == false)
                return;
            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "DtlImp_" + GetQueryString("FK_MapDtl") + "_BillModel";
            mapExt.RetrieveFromDBSources(); //从数据库来查询.
            mapExt.Delete();
            window.location.href = window.location.href;
        }

        function Save1() {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "DtlImp_" + GetQueryString("FK_MapDtl") + "_BillModel";
            mapExt.RetrieveFromDBSources(); //从数据库来查询.

            mapExt.CopyURL();  //从url里面copy数据.
            mapExt.FK_MapData = GetQueryString("FK_MapDtl");
            mapExt.CopyForm(); //从from里面copy数据.
            mapExt.ExtType = "DtlImp";
            mapExt.AttrOfOper = "BillModel"; //后台有默认设置，要使主键区分开，所以设置此值 
            var val = mapExt.Save();
            window.location.href = window.location.href;
        }
    </script>
    <style type="text/css">
        .style1
        {
            height: 21px;
        }
    </style>
</head>
<body>
    <div id="bar">
    </div>
    <table style="width: 99%;">
        <tr>
            <th colspan="2">
                基本信息
            </th>
        </tr>
        <tr>
            <td>
                <a href="javascript:alert('显示在窗口的文字，比如:搜索单据.')">标题</a>
            </td>
            <td>
                <input type="text" id="TBPara_Title" name="TBPara_Title" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td>
                弹窗属性
            </td>
            <td>
                高度:<input type="text" id="TB_H" name="TB_H" value="300" style="width: 80px; text-align: right" />
                宽度:<input type="text" id="TB_W" name="TB_W" value="600" style="width: 80px; text-align: right" />
            </td>
        </tr>
        <tr>
            <td>
                <a href="javascript:alert('显示在搜索文本框的背景文字,比如：请输入付款人名称,进行搜索.')">搜索提示</a>
            </td>
            <td>
                <input type="text" id="TBPara_SearchTip" name="TBPara_SearchTip" style="width: 90%;" />
            </td>
        </tr>
        <tr>
            <td>
                数据源类型
            </td>
            <td>
                <select id="DDL_DBType" name="DDL_DBType">
                    <option value="0">执行SQL</option>
                    <option value="1">执行url返回JSON</option>
                    <option value="2">执行CCFromRef.js返回JSON</option>
                </select>
            </td>
        </tr>
        <tr>
            <th colspan="2">
                单据主表配置
            </th>
        </tr>

        <tr>
            <td>
                初始化SQL
            </td>
                
            <td colspan="2">
                <textarea id="TB_Tag1" name="TB_Tag1" style="width: 98%; height: 60px;"></textarea>
            </td>
      
        </tr>
        <tr>
            <td>
                查询SQL
            </td>
            <td colspan="2">
                <textarea id="TB_Tag2" name="TB_Tag2" style="width: 98%; height: 60px;"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                对照列
            </td>
            <td colspan="2">
                <input type="text" id="TB_Tag3" name="TB_Tag3" style="width: 99%;" />
            </td>
            
        </tr>
        <!-- 从表配置 -->
        <tr>
            <th colspan="2">
                从表配置
            </th>
        </tr>
        <tr>
            <td>
                查询SQL
            </td>
            <td colspan="2">
                <textarea id="TB_Tag" name="TB_Tag" style="width: 98%; height: 60px;"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                装载SQL
            </td>
             <td colspan="2">
                <textarea id="TB_Tag4" name="TB_Tag4" style="width: 98%; height: 60px;"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                对照列
            </td>
            <td colspan="2">
                <input type="text" id="TB_Tag5" name="TB_Tag5" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="保存" id="Btn_Save" name="Btn_Save" onclick="return Save1()" />
                <input type="button" value="删除" id="Btn_Delete" name="Btn_Delete" onclick="return Delete()" />
            </td>
        </tr>
    </table>
</body>
</html>
